package com.example.newnoke.ui;

import android.databinding.DataBindingUtil;

import com.example.newnoke.R;
import com.example.newnoke.data.SuceedData;
import com.example.newnoke.databinding.ActivitySucceedBinding;
import com.example.newnoke.mvp.presenter.SuceedPresenter;
import com.example.newnoke.mvp.view.ISuceedV;
import com.example.newnoke.utils.API;
import com.geya.jbase.baseactivity.BaseDetailsActivity;
import com.geya.jbase.constant.RequestType;

import java.util.HashMap;

public class SucceedActivity extends BaseDetailsActivity<SuceedPresenter> implements ISuceedV {

    private ActivitySucceedBinding mBinding;

    @Override
    public SuceedPresenter newPresenter() {
        return new SuceedPresenter(this);
    }

    @Override
    public void init() {

        mTitleButton.setTitles("购买订单");
        HashMap<String, String> map = new HashMap<>();
        map.put("order_sn", getIntent().getStringExtra("id"));
        mPresenter.accessServers(RequestType.OKGO_POST, API.GETORDER, SuceedData.class, map);


    }

    @Override
    public void setContentView() {
        mBinding = DataBindingUtil.setContentView(this,R.layout.activity_succeed);
    }

    @Override
    public void setData(SuceedData.DataBean data) {
        mBinding.name.setText(data.getName());//姓名
        mBinding.shouji.setText(data.getMobile());//电话
        mBinding.gName.setText(data.getGoods_name());//资产名
        mBinding.price.setText(data.getTotal_price());//总价
        mBinding.dingdanhao.setText(data.getOrder_sn());//订单编号
        mBinding.sj.setText(data.getInputtime());//购买时间
    }
}
